import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/home/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'',
    redirect:'/home'
  },
  {
    path:'/',
    redirect:'/home'
  },
  {
    path: '/home',
    name: 'HomeView',
    component: () => import('@/views/home/HomeView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/category',
    name: 'CategoryView',
    component: () => import('@/views/category/CategoryView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/server',
    name: 'ServerView',
    component: () => import('@/views/server/ServerView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/shopcart',
    name: 'ShopcartView',
    component: () => import('@/views/shopcart/ShopcartView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/my',
    name: 'MyView',
    component: () => import('@/views/my/MyView.vue'),
    meta:{
      keep:true,
    },
    children:[
      {
        path: 'CollectedView',
        name: 'CollectedView',
        component: () => import('@/views/my/collectMenu/CollectedView.vue'),
        meta:{
          keep:true,
        },
      },
      {
        path: 'HistoryView',
        name: 'HistoryView',
        component: () => import('@/views/my/collectMenu/HistoryView.vue'),
        meta:{
          keep:true,
        },
      },
      {
        path: 'FollowedView',
        name: 'FollowedView',
        component: () => import('@/views/my/collectMenu/FollowedView.vue'),
        meta:{
          keep:true,
        },
      },
    ],
  },
  {
    path: '/goods-detail/:id',
    name: 'goodsDetailView',
    component: () => import('@/views/goodsDetail/goodsDetailView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/login',
    name: 'loginView',
    component: () => import('@/views/my/loginView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/capView',
    name: 'capView',
    component: () => import('@/views/my/capView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/CofirmBuy',
    name: 'CofirmBuyView',
    component: () => import('@/views/shopcart/CofirmBuyView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/BuyView',
    name: 'BuyView',
    component: () => import('@/views/shopcart/BuyView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/PayedView',
    name: 'PayedView',
    component: () => import('@/views/shopcart/PayedView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/TicketView/:index',
    name: 'TicketView',
    component: () => import('@/views/my/ticketView/TicketView.vue'),
    meta:{
      keep:true,
    },
    children:[
      {
        path: 'AllTicketView',
        name: 'AllTicketView',
        component: () => import('@/views/my/ticketView/AllTicketView.vue'),
      },
      {
        path: 'PayingTicketView',
        name: 'PayingTicketView',
        component: () => import('@/views/my/ticketView/PayingTicketView.vue'),
      },
      {
        path: 'ReceiveTicketView',
        name: 'ReceiveTicketView',
        component: () => import('@/views/my/ticketView/ReceiveTicketView.vue'),
      },
      {
        path: 'CommentTicketView',
        name: 'CommentTicketView',
        component: () => import('@/views/my/ticketView/CommentTicketView.vue'),
      },
    ],
  },
  {
    path: '/SearchView',
    name: 'SearchView',
    component: () => import('@/views/home/SearchView.vue'),
    meta:{
      keep:true,
    },
  },
  {
    path: '/commentTicket',
    name: 'commentTicket',
    component: () => import('@/views/my/ticketView/toComment.vue'),
    meta:{
      keep:true,
    },
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
